package com.stoken.service.impl;

import java.text.DateFormat;
import java.util.Date;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

import com.stoken.service.BonusCalculationService;

public class CalculationHitJob implements Job {
	
	

	@Override
	public void execute(JobExecutionContext jobC) throws JobExecutionException {
		 //yyyy-MM-dd HH:mm:ss 
		 System.out.println("程序执行计算奖金： "+ new Date().toString());
		  WebApplicationContext webAppContext = ContextLoader.getCurrentWebApplicationContext();
		  BonusCalculationService bonusCalculationService = (BonusCalculationService) webAppContext.getBean("bonusCalculation");
		  bonusCalculationService.calculateHitBonus();
		  System.out.println("程序计算奖金结束："+ new Date().toString());
		 
	}

}
